'use strict'

function getproduct(keyword){
    return new Promise(function(reslove,reject){
        $.get('http://localhost:8000/product?keyword='+keyword,data=>{
            reslove(data)
        })
    })
}
function postproduct(obj){
    return new Promise(function(reslove,reject){
        $.post('http://localhost:8000/product',obj,data=>{
            reslove(data)
        })
    })
}
function putproduct(obj,id){
    return new Promise(function(reslove,reject){
        $.ajax({
            url:`http://localhost:8000/product/${id}`,
            type:'put',
            data:obj,
            success:data=>{
                reslove(data)
            }
        })
    })
}
function delproduct(id){
    return new Promise(function(reslove,reject){
        $.ajax({
            url:`http://localhost:8000/product/${id}`,
            type:'delete',
            success:data=>{
                reslove(data)
            }
        })
    })
}